core: Do enumerate ff/ objects as well
authorColin Walters <walters@verbum.org>
Sun, 20 Jul 2014 16:20:51 +0000 (12:20 -0400)
committerColin Walters <walters@verbum.org>
Mon, 21 Jul 2014 11:25:51 +0000 (07:25 -0400)
An embarassing off-by-one here.  I noticed we weren't pruning them.

https://bugzilla.gnome.org/show_bug.cgi?id=733458

src/libostree/ostree-repo.c
tests/test-basic.sh

index 1aa48e620fc3c2b71640b90fa9ecf478ec69d04b..6f04360ff70010e0f46c2d0e5cc5e031220ccac4 100644 (file)
@@ -1083,7 +1083,7 @@ list_loose_objects (OstreeRepo                     *self,
   int dfd = -1;
   static const gchar hexchars[] = "0123456789abcdef";
 
-  for (c = 0; c < 255; c++)
+  for (c = 0; c < 256; c++)
     {
       char buf[3];
       buf[0] = hexchars[c >> 4];
index dfad255198b46526891cbea54fcd197fa8d0130c..19e98b1ebc9dc591aedfca8611e3b082929dbf8e 100755 (executable)
@@ -235,6 +235,19 @@ fi
 rm repo3 objlist-before-prune objlist-after-prune -rf
 echo "ok prune"
 
+cd ${test_tmpdir}
+rm repo3 -rf
+${CMD_PREFIX} ostree --repo=repo3 init --mode=archive-z2
+${CMD_PREFIX} ostree --repo=repo3 pull-local --remote=aremote repo test2
+rm repo3/refs/remotes -rf
+mkdir repo3/refs/remotes
+ostree --repo=repo3 prune --refs-only
+find repo3/objects -name '*.filez' > file-objects
+if test -s file-objects; then
+    assert_not_reached "prune didn't delete all objects"
+fi
+echo "ok prune in archive-z2 deleted everything"
+
 cd ${test_tmpdir}
 $OSTREE commit -b test3 -s "Another commit" --tree=ref=test2
 ostree --repo=repo refs > reflist